会C""的帮个忙:从键盘中连续输入整数,直到输入0结束,然后输出最大的

来源:百度知道 编辑:UC知道 时间:2024/06/24 16:04:15
菜鸟谢谢大家了

来个C++的
#include <iostream>
using namespace std;
void main()
{
int x;
bool falg=true;
int max=0;
while(cin>>x,x!=0)
{
if(flag)
{
max=x;
flag=false;
}
if(max<x)
{
max=x;
}
}
cout<<"the max num is :"<<max<<endl;
}